package com.example.demo;

import com.example.demo.IService.IUserService;
import com.example.demo.dao.UserMapper;
import com.example.demo.domin.User;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@MapperScan("com.example.demo.dao")
@SpringBootApplication
public class DemoApplication {

	@Autowired
	private UserMapper userMapper;

	@Autowired
	private IUserService userService;

	@Value("${my.name}")
	private String myname;

	@Value("${my.love}")
	private String mylove;

	@RequestMapping("/bbb")
	public String testMethod() {

		User user = userService.getUserById();
		System.out.println("---------------- test");
//		return  "hello -- " + myname + " hello -- mylove " + mylove;
		return "hello " +  myname + " mybatis--- user--" + user.getUsername();
	}

	public static void main(String[] args) {

		SpringApplication.run(DemoApplication.class, args);
	}
}
